var RPCClient = require('@alicloud/pop-core').RPCClient;

function initVodClient(accessKeyId, accessKeySecret,) {
    var regionId = 'cn-shanghai';   // 点播服务接入地域
    var client = new RPCClient({//填入AccessKey信息
        accessKeyId: accessKeyId,
        accessKeySecret: accessKeySecret,
        endpoint: 'http://vod.' + regionId + '.aliyuncs.com',
        apiVersion: '2017-03-21'
    });

    return client;
}


const getvod = async (req, res) => {
    // 请求示例
    let client = initVodClient( // 这里就是传入创建rma账号的id和secret
        'LTAI5tCSDQ4BA8K3XGQKuT4f',
        'opwjNqwjtLjVtungqHmQFKP6iU1UpZ'
    );
    const vodback = await client.request("CreateUploadVideo", {
        Title: 'test vod',
        FileName: 'filename.mp4'
    }, {})
    res.status(200).json({
        error: 0,
        msg:'成功获取凭证',
        data:vodback
    })
}




module.exports = {
    getvod
}